<#macro templateTree filepath>
    <@_templateList path=filepath>
        <@_metadata dir=filepath><#local metaDataMap=object/></@_metadata>
        <#list list as a>
            <li>
                <#local path=filepath+'/'+a.fileName>
                <a href="cmsTemplate/${a.directory?then('directory','content')}.html?path=${(path?url)!}" target="ajax" rel="cmsTemplateBox">
                    ${a.fileName} ${(metaDataMap[a.fileName].alias)?has_content?then('('+metaDataMap[a.fileName].alias+')','')}
                </a>
            <#if a.directory>
                <ul>
                    <@templateTree path/>
                </ul>
            </#if>
            </li>
        <#else>
            <li><a><@t.page 'empty_directory'/></a></li>
        </#list>
    </@_templateList>
</#macro>
<div class="pageContent">
    <div layoutH="0" style="float:left; display:block; overflow:auto; width:240px;border-right:solid 1px #CCC; line-height:21px;">
        <h2 class="contentTitle">
            <a class="button" href="cmsTemplate/metadata.html?path=/" target="ajax" rel="cmsTemplateBox"><@t.page 'template.create'/></a>
        </h2>
        <ul class="tree treeFolder" layoutH="48">
            <@templateTree ''/>
        </ul>
    </div>
    <div id="cmsTemplateBox" style="margin-left:240px;">
        <#include "directory.html"/>
    </div>
</div>